home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / programming / arexx / rxcmanager / examples / e2aw.rexx < prev    next >
OS/2 REXX Batch file  |  1999-05-25  |  1KB  |  64 lines

  1. /*
  2. Author:        Alfonso Ranieri <alfier@iol.it>
  3. Desription:    export to AWeb hot list
  4. Template:      KEY,USER/K
  5. Tipical usage: rx e2aw >file
  6. */
  7.  
  8. call addlib("rmh.library",0,-30) then exit
  9. call addlib("rxcmanager.library",0,-30) then exit
  10.  
  11. if ~open("STDERR","CONSOLE:","W") then stderr="STDOUT"
  12.  
  13. prg=programname("NOEXT")
  14. if ~RMH_ReadArgs("KEY,USER/K") then do
  15.     call printfault(ioerr(),prg)
  16.     exit
  17. end
  18.  
  19. if parm.0.flag then k = "#?"parm.0.value"#?"
  20. else k = "#?"
  21.  
  22. if parm.1.flag then call CMUserData(parm.1.value)
  23.  
  24. patt.Name    = k
  25. patt.WWW     = k
  26. patt.Comment = k
  27. num = CMFind("WWW GROUPS","URL","PATT")
  28. if num=1 then call info "No url entry found"
  29. else call info "Found" num "url(s)"
  30.  
  31. say "@AWeb hotlist"
  32.  
  33. g=""
  34. p=""
  35. ng=0
  36. do i=0 to num-1
  37.     if url.i.Group~=g then do
  38.         if g~="" then do
  39.             if url.i.Group~=g & url.i.parents="" then call endG
  40.         end
  41.         say "@GROUP" url.i.Group
  42.         ng=ng+1
  43.         g=url.i.Group
  44.     end
  45.     if ~url.i.EmptyGroup then do
  46.         say url.i.WWW
  47.         say url.i.Name
  48.     end
  49. end
  50. call endG
  51. exit
  52.  
  53. info: procedure expose stderr prg
  54. parse arg msg
  55.     call writeln(stderr,prg":" msg)
  56.     return
  57.  
  58. endG: procedure expose ng
  59.     do j=0 to ng-1
  60.         say "@ENDGROUP"
  61.     end
  62.     ng=0
  63.     return
  64.